<?php

/** libraries
 * http://docs.joomla.org/JToolBarHelper
 */

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

// import Joomla view library
jimport('joomla.application.component.view');

class bgViewbg extends JView
{
	// Overwriting JView display method
	function display($tpl = null) 
	{
	    $model = $this->getModel();
        $task = &JRequest::getVar('task');
        $this->list['area'] = &JRequest::getVar('area');
        $this->list['area_pref'] = &JRequest::getVar('area_pref');
         $this->list['unit'] = &JRequest::getVar('unit');
        $this->list['term'] = &JRequest::getVar('term');
         $this->list['pref'] = &JRequest::getVar('pref');
        $this->list['nameld'] = &JRequest::getVar('nameld');
        $this->list['chb1'] = &JRequest::getVar('chb1');
        $this->list['chb2'] = &JRequest::getVar('chb2');
        $this->list['wokf'] = &JRequest::getVar('wokf');
        switch($task){
            case 'detail':
                $this->setLayout('detail');
                /* get list center club */
                $this->ocba=$model->getAllOCBA();
                /* get list area */
                $this->area=$model->getAllArea();
                /* get list lien ket dao tao */
                $this->lkdt=$model->getAllLkdt();
                $a=$model->getTotalLkdt();
                /* load checkbox lien ket dao tao*/
                for($i=1;$i<=$a;$i++)
                {
                    $this->list['chl'.$i] = &JRequest::getVar('chl'.$i);
                }
                $area_code=0;
                /* get list human */
                $this->human=$model->getAllHuman();
                /* get list pref */
                $this->pref=$model->getAllPref($area_code);
                /* get id from url */
                $cid = JRequest::getVar('cid');
                /* get data  */
                $this->rows = $model->load($cid);
                /* get list coli*/
                $this->colis = $model->loadcoli($cid);
                
            break;
            default :
                //check submit search
                $check = &JRequest::getVar('check');
                if($check == '1')
                {
                    $this->sr = '1';
                }
                else $this->sr = '0';
               
                $this->setLayout('default');
                /* get list center club */
                $this->ocba=$model->getAllOCBA();
                /* get list area */
                $this->area=$model->getAllArea();
                /* get list lien ket dao tao*/
                $this->lkdt=$model->getAllLkdt();
                $area_code=0;
                /* get list pref*/
                $this->pref=$model->getAllPref($area_code);
                
                $a=$model->getTotalLkdt();
                for($i=1;$i<=$a;$i++)
                {
                    $this->list['chl'.$i] = &JRequest::getVar('chl'.$i);
                }
                $this->rows = $model->getAll($this->list);
                /* get Pagination */
                $this->pagination =& $this->get('Pagination');
                
                 
        }
		parent::display();
	}
}




